package com.itshizhan.livedatademo

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import kotlinx.android.synthetic.main.activity_main.*

class MainViewModelanother: ViewModel() {
    private lateinit var result: MutableLiveData<Int>

    fun getResult(): MutableLiveData<Int> {
        if (result==null){
            result = MutableLiveData<Int>()
            result.value = 0
        }
        return result
    }

    fun add(number1: Int,number2:Int) {
        result.value = number1 + number2
    }


}